home *** CD-ROM | disk | FTP | other *** search
- /* $VER: PGPDecrypt.thor 3.3 (21.02.95)
- *
- * Arexx script to decrypt PGP messages. When executed will the current message
- * in Thor be fed to PGP. The decrypted message will be put into the message
- * listview where it can be viewed and replied.
- *
- * Script by: Eivind Nordseth, Ultima Thule Software.
- */
-
- /* trace results */
-
- options results
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- if ~show('p', 'BBSREAD') then do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- filename = 't:pgptext'
- outfile = 't:pgpout'
-
- address command
- if exists(filename) then 'delete >nil:' filename
- if exists(outfile) then 'delete >nil:' outfile
-
- address(thorport)
- SAVEMESSAGE CURRENT FILE filename NOHEADER
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"Not able to save current message."' BT '"_Ok"'
- exit
- end
-
- address command 'search >nil:' filename '"BEGIN PGP MESSAGE" QUICK QUIET'
- if(rc = 5) then
- do
- address command 'search >nil:' filename '"BEGIN PGP SIGNED MESSAGE" QUICK QUIET'
- if(rc = 5) then
- do
- REQUESTNOTIFY TEXT '"This is not a PGP encrypted or signed message"' BT '"_Ok"'
- exit
- end
- end
-
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"Search failed. Check path."' BT '"_Ok"'
- exit
- end
-
- GETGLOBALCONFIG CFG
- if(rc ~= 0) then exit
-
- address BBSREAD GETGLOBALDATA stem GLOBALDATA
- if(rc ~= 0) then exit
-
- Call Close 'STDOUT'
- Call Close 'STDIN'
- Call Open 'STDOUT','CON:0/13//150/PGPAmiga/AUTO/CLOSE/WAIT/SCREEN' || CFG.PUBSCREENNAME
- Call Pragma '*','STDOUT'
- Call Open 'STDIN','*'
-
- if GLOBALDATA.PGPCommand = '' then
- do
- call getpath
- pgpcommand = result
- end
- else pgpcommand = GLOBALDATA.PGPCOMMAND
-
- address command pgpcommand filename ' -o' outfile
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"PGP failed. Check path or PGPPATH envirorment variable."' BT '"_Ok"'
- exit
- end
-
- SHOWTEXT outfile CURRENTMSGTEXT
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"Not able to show the decrypted message."' BT '"_Ok"'
- exit
- end
-
-
- address command
- if exists(filename) then 'delete >nil:' filename
- if exists(outfile) then 'delete >nil:' outfile
- exit 0
-
-
- getpath: procedure
- address command 'GetEnv >PIPE:PGPPATH PGPPATH'
- If rc = 0 Then
- Do
- If Open('ppath','PIPE:PGPPATH','R') Then
- Do
- path = ReadLN('ppath')
- If ~Close('ppath') Then Nop
- path = path||'/PGP'
- Return path
- End
- Else Return ""
- End
-